package org.openfans.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * 类说明：小组<br>
 * 创建时间：2006-5-22<br>
 * 
 * @author 张俊<br>
 * @email:pesome@gmail.com<br>
 */
public class Group extends PersistentObject {
	private Date createDate;

	private Fans creator;

	/**
	 * @uml.property name="descn"
	 */
	private String descn;

	// 小组的黑板报，目前由组长维护
	private String board;

	private int fansCount;

	/**
	 * @uml.property name="fans" multiplicity="(0 -1)"
	 */
	private Set<Fans> fansSet;

	/**
	 * @uml.property name="groupId"
	 */
	private int groupId;

	private int hot;

	private String icon;

	/**
	 * @uml.property name="name"
	 */
	private String name;

	/**
	 * @uml.property name="url"
	 */
	private String url;
	

	/**
	 * 功能说明：<br>
	 * 创建者：张俊<br>
	 * 创建时间：2006-5-29<br>
	 * 
	 * @param fans
	 */
	void addFans(Fans fans) {
		if (null == fansSet) {
			fansSet = new HashSet<Fans>();
		}
		fansSet.add(fans);
	}

	public void addHot(int i) {
		hot += i;
	}

	public boolean containsFans(Fans fans) {
		return fansSet.contains(fans);
	}

	public Date getCreateDate() {
		return createDate;
	}

	public Fans getCreator() {
		return creator;
	}

	/**
	 * @return Returns the descn.
	 * @uml.property name="descn"
	 */
	public String getDescn() {
		return descn;
	}

	public int getFansCount() {
		return fansCount;
	}

	public Set<Fans> getFansSet() {
		return fansSet;
	}

	/**
	 * @return Returns the groupId.
	 * @uml.property name="groupId"
	 */
	public int getGroupId() {
		return groupId;
	}

	public int getHot() {
		return hot;
	}

	public String getIcon() {
		return icon;
	}

	/**
	 * @return Returns the name.
	 * @uml.property name="name"
	 */
	public String getName() {
		return name;
	}

	public String getUrl() {
		return url;
	}

	public void increaseFansCount(int i) {
		this.fansCount += i;
	}

	void removeFans(Fans fans) {
		fansSet.remove(fans);
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public void setCreator(Fans creator) {
		this.creator = creator;
	}

	/**
	 * @param descn
	 *            The descn to set.
	 * @uml.property name="descn"
	 */
	public void setDescn(String descn) {
		this.descn = descn;
	}

	public void setFansCount(int fansCount) {
		this.fansCount = fansCount;
	}

	public void setFansSet(Set<Fans> fansSet) {
		this.fansSet = fansSet;
	}

	/**
	 * @param groupId
	 *            The groupId to set.
	 * @uml.property name="groupId"
	 */
	public void setGroupId(int groupId) {
		this.groupId = groupId;
	}

	public void setHot(int hot) {
		this.hot = hot;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getBoard() {
		return board;
	}

	public void setBoard(String board) {
		this.board = board;
	}

}
